package com.gjy.kafka.java;

import org.apache.kafka.common.serialization.Deserializer;
import org.apache.kafka.common.serialization.Serializer;

import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.Objects;

/**
 * @author gjy
 * @version 1.0
 * @since 2024-07-04 21:37:29
 */
public class AlterKeySerde implements Serializer<Alter>, Deserializer<Alter> {
    @Override
    public Alter deserialize(String topic, byte[] key) {
        return null;
    }

    @Override
    public void configure(Map<String, ?> configs, boolean isKey) {
    }

    @Override
    public byte[] serialize(String topic, Alter key) {
        if (Objects.isNull(key)) {
            return null;
        }
        return key.getStageId().getBytes(StandardCharsets.UTF_8);
    }

    @Override
    public void close() {
    }
}
